<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="./lib/axios.js"></script>
    <script src="./lib/vue.js"></script>
    <script src="./lib/elementui.js"></script>
    <script src="http://libs.baidu.com/jquery/2.0.0/jquery.min.js"></script>
    <link rel="stylesheet" href="./lib/elementui.css">
</head>

<body>
    <div id="registPage">
        <div class="regist-pad">
            <h2>用户注册</h2>
            <el-input v-model="userName" placeholder="请输入用户名"></el-input>
            <el-input v-model="userNo" placeholder="请输入用户账号"></el-input>
            <el-input v-model="password" placeholder="请输入登陆密码"></el-input>
            <el-input v-model="password2" placeholder="请输入登陆密码"></el-input>
            <el-button type="primary" @click="regist">注册用户</el-button>
        </div>

        <!-- <form action="http://localhost:5000/login" method="post">
            <input type="text" name="userName" value="">
            <input type="text" name="userNo" value="">
            <input type="text" name="password" value="">
            <input type="submit" value="注册">
        </form> -->
    </div>
    <script>
        var vm = new Vue({
            el: "#registPage",
            data: {
                userName: "",
                userNo: "",
                password: "",
                password2: ""
            },
            methods: {
                regist: function () {
                    // $.post("http://localhost:5000/login",
                    //     {
                    //         userName: this.userName,
                    //         userNo: this.userNo,
                    //         password: this.password
                    //     }, function (res) {
                    //         console.log(res);
                    //     });
                    axios.post(
                        "http://localhost:5000/login/test",
                        {
                            id: this.userName,
                        }).then(function (res) {
                            console.log(res);
                        })
                    // axios.post(
                    //     "http://localhost:5000/login",
                    //     {
                    //         userName: this.userName,
                    //         userNo: this.userNo,
                    //         password: this.password
                    //     }).then(function (res) {
                    //         console.log(res);
                    //     })
                    axios.post(
                        "http://localhost:5000/login",
                        {
                            userName: this.userName,
                            userNo: this.userNo,
                            password: this.password
                        }).then(function (res) {
                            console.log(res);
                        })
                }
            },
        })
    </script>
    <style>
        .regist-pad {
            width: 600px;
            padding: 20px;
            margin: auto;
            margin-top: 10%;
            border: 1px solid #ccc;
            border-radius: 6px;
            box-shadow: 0 0 10px #ccc;
        }

        h2 {
            text-align: center;
            margin-top: 0;
        }

        .el-input {
            margin-bottom: 20px;
        }

        .el-button {
            width: 100%;
        }
    </style>
</body>

</html>